package java6681.lesson13;

/**
 * @author Junichiro
 * @description 两种多线程编程模型的比较
 * @date 2021-06-05 18:56
 **/

public class ThreadAndRunnable6681 {
    public static void main(String[] args) {
        //Thread
//        saleByThread6681();
        //Runnable
        saleByRunnable6681();
    }
    private static void saleByThread6681() {
        TicketThread6681 t1 = new TicketThread6681("张舒婷1");
        TicketThread6681 t2 = new TicketThread6681("张舒婷2");
        TicketThread6681 t3 = new TicketThread6681("张舒婷3");
        t1.start();
        t2.start();
        t3.start();
    }

    private static void saleByRunnable6681() {
        TicketRunnable6681 ticRun = new TicketRunnable6681();
        Thread t1 = new Thread(ticRun,"张舒婷1");
        Thread t2 = new Thread(ticRun,"张舒婷2");
        Thread t3 = new Thread(ticRun,"张舒婷3");
        t1.start();
        t2.start();
        t3.start();
    }
}
